const state = {
  currentStep: 1,
  formStep1Data: {},
  formStep2Data: [],
  formStep3Data: [],

  step1UseTableId: '', // 使用表的id
  sceneId: '', // 创建的场景的id
  isChangeStep1UseTable: false, // 用来区分当前是否直接在step1改变了使用表值

  selectedTableStep3: [] // 暂存第三步选中的表格项
};

const mutations = {
  changeCurrentStep(state: any, data: any) {
    state.currentStep = data;
  },

  saveFormStep1Data(state: any, data: any) {
    state.formStep1Data = data;
  },

  saveFormStep2Data(state: any, data: any) {
    state.formStep2Data = data;
    // console.log('状态机step2的数据', data);
  },

  saveFormStep3Data(state: any, data: any) {
    // console.log('状态机step3的数据', data);
    state.formStep3Data = data;
  },

  resetFormStep1(state: any, data: any) {
    state.formStep1Data = {};
  },
  resetFormStep2(state: any, data: any) {
    state.formStep2Data = [];
  },
  resetFormStep3(state: any, data: any) {
    state.formStep3Data = [];
  },
  resetUseTableId(state: any, data: any) {
    state.step1UseTableId = '';
  },
  resetSceneId(state: any, data: any) {
    state.sceneId = '';
  },
  changeStep1UseTableId(state: any, data: any) {
    console.log('改变了第一个id');
    state.step1UseTableId = data;
  },
  setSceneId(state: any, data: any) {
    state.sceneId = data;
  },
  changeStep1UseTable(state: any, data: any) {
    state.isChangeStep1UseTable = data;
  },
  saveSelectedTableStep3(state: any, data: any) {
    state.selectedTableStep3 = data;
  },
  resetSelectedTableStep3(state: any, data: any) {
    state.selectedTableStep3 = [];
  }
};

const actions = {};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
